#define _CRT_SECURE_NO_WARNINGS 1

#include "SLT.h"

void TestSLT1(void)
{
	SLTNode* plist = NULL;

	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTPushFront(&plist, 5);
	SLTPushFront(&plist, 6);
	SLTPushFront(&plist, 7);

	//SLTPopBack(&plist);
	//SLTPopBack(&plist);
	//SLTPopBack(&plist);
	//SLTPopBack(&plist);
	//SLTPopBack(&plist);
	//SLTPopBack(&plist);
	//SLTPopBack(&plist);
	////SLTPopBack(&plist);

	SLTPopFront(&plist);
	SLTPopFront(&plist);
	SLTPopFront(&plist);
	SLTPopFront(&plist);
	SLTPopFront(&plist);
	SLTPopFront(&plist);
	SLTPopFront(&plist);
	SLTPopFront(&plist);

	SLTPrint(plist);
}

void TestSLT2(void)
{
	SLTNode* plist = NULL;

	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTPrint(plist);

	SLTFind(plist, 2);
	SLTFind(plist, 5);
}

void TestSLT3(void)
{
	SLTNode* plist = NULL;

	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPopBack(&plist);
	//1->NULL

	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 4);
	SLTPopFront(&plist);
	//3->1->NULL

	SLTPrint(plist);

	SLTFind(plist, 1);
	SLTFind(plist, 5);
}

void TestSLT4(void)
{
	SLTNode* plist = NULL;
	
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPushBack(&plist, 5);

	SLTNode* pos = SLTFind(plist, 3);
	//SLTInsertBefore(pos, 100);
	//SLTInsertBeforeH(&plist, pos, 100);
	//SLTInsertAfter(pos, 39);

	SLTPrint(plist);
}

void TestSLT5(void)
{
	SLTNode* plist = NULL;

	//SLTPushBack(&plist, 1);
	//SLTPushBack(&plist, 2);
	//SLTPushBack(&plist, 3);
	//SLTPushBack(&plist, 4);
	//SLTPrint(plist);
	
	//SLTNode* pos = SLTFind(plist, 1);
	//SLTErase(&plist, pos);
	//SLTPrint(plist);

	//pos = SLTFind(plist, 2);
	//SLTErase(&plist, pos);
	//SLTPrint(plist);

	//pos = SLTFind(plist, 3);
	//SLTErase(&plist, pos);
	//SLTPrint(plist);

	//pos = SLTFind(plist, 5);
	//SLTErase(&plist, pos);
	//SLTPrint(plist);

	//SLTPushFront(&plist, 1);
	//SLTPushFront(&plist, 2);
	//SLTPushFront(&plist, 3);
	//SLTPushFront(&plist, 4);
	//SLTPrint(plist);

	//SLTNode* pos = SLTFind(plist, 4);
	//SLTEraseAfter(pos);
	//SLTPrint(plist);

	//pos = SLTFind(plist, 1);
	//SLTEraseAfter(pos);
	//SLTPrint(plist);

	//SLTPushFront(&plist, 1);
	//SLTPrint(plist);

	//SLTNode* pos = SLTFind(plist, 1);
	//SLTEraseAfter(pos);
	//SLTPrint(plist);

	SLTPushFront(&plist, 1);
	SLTPrint(plist);

	SLTNode* pos = SLTFind(plist, 2);
	SLTEraseAfter(pos);
	SLTPrint(plist);

	
}

void TestSLT6(void)
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTNode* pos = SLTFind(plist, 1);
	SLTErase(pos);
	SLTPrint(plist);
}

int main()
{
	//TestSLT1();

	//TestSLT2();

	//TestSLT3();

	//TestSLT4();

	//TestSLT5();

	TestSLT6();

	return 0;
}